package com.wdc.application;

import java.util.concurrent.CountDownLatch;

public class CountDownLatchDemo {
    public static void main(String[] args) throws InterruptedException {

        CountDownLatch latch = new CountDownLatch(6);

        for (int i = 0; i < 10; i++) {
            new Thread(() -> {

                System.out.println(Thread.currentThread().getName() + "  go out");
                latch.countDown();
            }, String.valueOf(i)).start();

        }

        latch.await();


        System.out.println("Close door");



    }
}
